//
//  GameInfoTableViewCell.m
//  NBAPro
//
//  Created by 李广松 on 16/7/13.
//  Copyright © 2016年 WYH. All rights reserved.
//

#import "GameInfoTableViewCell.h"

@implementation GameInfoTableViewCell {
    float fontFlo;
}

@synthesize nameLabel,positionLabel, ptsLabel, astLabel, rebLabel, fgLabel, blkLabel, stlLabel, threePtLabel, ptLabel, toLabel, topLine, downLine;

- (id)initWithFont:(float)font {
    
    fontFlo = font;
    
    self = [super init];
    if (self) {
        
        [self createLine];
        
        nameLabel = [self createLabelWithFrame:CGRectMake(0, 0, 90, 42)];
        [self addSubview:nameLabel];

        positionLabel = [self createDataInfoLabelWithFrame:CGRectMake(90, 0, 1, 42)];
        [self addSubview:positionLabel];
        
        ptsLabel = [self createDataInfoLabelWithFrame:CGRectMake(positionLabel.frame.origin.x + positionLabel.frame.size.width, 0, 1, 42)];
        [self addSubview:ptsLabel];

        astLabel = [self createDataInfoLabelWithFrame:CGRectMake(ptsLabel.frame.origin.x + ptsLabel.frame.size.width, 0, 1, 42)];
        [self addSubview:astLabel];
        
        rebLabel = [self createDataInfoLabelWithFrame:CGRectMake(astLabel.frame.origin.x + astLabel.frame.size.width, 0, 1, 42)];
        [self addSubview:rebLabel];
        
        fgLabel = [self createDataInfoLabelWithFrame:CGRectMake(rebLabel.frame.origin.x + rebLabel.frame.size.width, 0, 1, 42)];
        [self addSubview:fgLabel];
        
        blkLabel = [self createDataInfoLabelWithFrame:CGRectMake(fgLabel.frame.origin.x + fgLabel.frame.size.width, 0, 1, 42)];
        [self addSubview:blkLabel];
        
        stlLabel = [self createDataInfoLabelWithFrame:CGRectMake(blkLabel.frame.origin.x + blkLabel.frame.size.width, 0, 1, 42)];
        [self addSubview:stlLabel];
        
        threePtLabel = [self createDataInfoLabelWithFrame:CGRectMake(stlLabel.frame.origin.x + stlLabel.frame.size.width, 0, 1, 42)];
        [self addSubview:threePtLabel];
        
        ptLabel = [self createDataInfoLabelWithFrame:CGRectMake(threePtLabel.frame.origin.x + threePtLabel.frame.size.width, 0, 1, 42)];
        [self addSubview:ptLabel];
        
        toLabel = [self createDataInfoLabelWithFrame:CGRectMake(ptLabel.frame.origin.x + ptLabel.frame.size.width, 0, 1, 42)];
        [self addSubview:toLabel];
        

        
    }
    
    return self;
}

- (void)createLine {
    topLine = [self createLineWithFrame:CGRectMake(0, 0, 750, 0.5)];
    downLine = [self createLineWithFrame:CGRectMake(0, 42 - 0.5, 750, 0.5)];
    
    [self addSubview:topLine];
    [self addSubview:downLine];
}

- (UILabel *)createDataInfoLabelWithFrame:(CGRect)frame {
    UIView *line = [self createLineWithFrame:frame];
    [self addSubview:line];
    
    UILabel *label = [self createLabelWithFrame:CGRectMake(line.frame.origin.x + line.frame.size.width, 0, 64, 42)];
    label.textAlignment = NSTextAlignmentCenter;
    
    
    return label;
}

- (UILabel *)createLabelWithFrame:(CGRect)frame {
    UILabel *label = [[UILabel alloc] initWithFrame:frame];
    label.textColor = [UIColor colorWithRed:111/255.0 green:125/255.0 blue:149/255.0 alpha:1];
    label.font = [UIFont systemFontOfSize:fontFlo];
    label.backgroundColor = [UIColor clearColor];
    label.textAlignment = NSTextAlignmentCenter;
    
    return  label;
}

- (UIView *)createLineWithFrame:(CGRect)frame {
    
    UIView *view = [[UIView alloc] initWithFrame:frame];
    view.backgroundColor = [UIColor colorWithRed:133/255.0 green:133/255.0 blue:133/255.0 alpha:1];
    
    return view;
}



@end
